Skip to content

Conversation

@cx-ben-alvo
Copy link
Collaborator

@cx-ben-alvo cx-ben-alvo commented Dec 5, 2024

Introduce a new integration test to verify handling of the resubmit flag during scan creation for non-existent projects, ensuring successful creation with default config. Additionally, fix the logic to retrieve configuration only when scans are available, preventing potential nil pointer dereferences.

By submitting a PR to this repository, you agree to the terms within the Checkmarx Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

Description

Introduce a new integration test to verify handling of the resubmit flag during scan creation for non-existent projects, ensuring successful creation with default config. Additionally, fix the logic to retrieve configuration only when scans are available, preventing potential nil pointer dereferences.

References

https://checkmarx.atlassian.net/browse/AST-76622

Testing

Added integration test

Checklist

  • I have added documentation for new/changed functionality in this PR (if applicable).
  • I have updated the CLI help for new/changed functionality in this PR (if applicable).
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used

Introduce a new integration test to verify handling of the resubmit flag during scan creation for non-existent projects, ensuring successful creation with default config. Additionally, fix the logic to retrieve configuration only when scans are available, preventing potential nil pointer dereferences.
@github-actions github-actions bot added the bug Something isn't working label Dec 5, 2024
@cx-ben-alvo cx-ben-alvo changed the title Add test for resubmit flag and fix config retrieval logic Add test for resubmit flag and fix config retrieval logic (AST-76622) Dec 5, 2024
@cx-ben-alvo cx-ben-alvo changed the title Add test for resubmit flag and fix config retrieval logic (AST-76622) CLI | Fix config retrieval logic (AST-76622) Dec 5, 2024
@github-actions
Copy link

github-actions bot commented Dec 5, 2024

Logo
Checkmarx One – Scan Summary & Detailsfcca7bda-7d28-4804-bff3-78d2fab95df4

No New Or Fixed Issues Found

Simplified the retrieval of config and engines by using a single variable, `scanModelResponse`, to improve code readability and maintainability. This change consolidates access to elements of `allScansModel.Scans[0]` into one clear reference point, making the code easier to understand and modify in the future.
Updated the ScansMockWrapper's Get method to return an empty configuration if the project ID is "non-existent-project". Added a test to ensure that the method behaves correctly in this scenario, verifying that an empty configuration is returned when attempting to resubmit a scan for a non-existent project.
@cx-ben-alvo cx-ben-alvo merged commit 2004d56 into main Dec 15, 2024
13 checks passed
@cx-ben-alvo cx-ben-alvo deleted the bug/benalvo/use-default-config-in-resubmit-flag-case branch December 15, 2024 16:25
cx-anjali-deore pushed a commit that referenced this pull request Jul 3, 2025
* Add test for resubmit flag and fix config retrieval logic

Introduce a new integration test to verify handling of the resubmit flag during scan creation for non-existent projects, ensuring successful creation with default config. Additionally, fix the logic to retrieve configuration only when scans are available, preventing potential nil pointer dereferences.

* Refactor scan model response variable assignment

Simplified the retrieval of config and engines by using a single variable, `scanModelResponse`, to improve code readability and maintainability. This change consolidates access to elements of `allScansModel.Scans[0]` into one clear reference point, making the code easier to understand and modify in the future.

* Handle non-existent projects in ScansMockWrapper Get method.

Updated the ScansMockWrapper's Get method to return an empty configuration if the project ID is "non-existent-project". Added a test to ensure that the method behaves correctly in this scenario, verifying that an empty configuration is returned when attempting to resubmit a scan for a non-existent project.

* Refactor variable name in ScansMockWrapper Get function

* fix trivy vul

* fix trivy vul

* fix trivy vul

* fix trivy vul

* fix trivy vul

* dix healthcheck vul

---------

Co-authored-by: AlvoBen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants